<?php
// Prevenir que jquery se cargue dos veces
Yii::app()->clientScript->scriptMap['jquery.js'] = false;
Yii::app()->clientScript->scriptMap['jquery.yiigridview.js'] = false;
Util::tsRegisterAssetJs('_medio_envio_email.js');

$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
    'id' => 'medio-envio-form',
    'type' => 'horizontal',
//    'action' => Yii::app()->createUrl('/crm/contacto/create'),
    'enableAjaxValidation' => true,
    'clientOptions' => array('validateOnSubmit' => false, 'validateOnChange' => false,),
    'enableClientValidation' => false,
        ));
?>

<div class="modal-header">
    <a class="close" data-dismiss="modal">&times;</a>
    <h4><i class="icon-envelope"></i> Medios de Envio</h4>
</div>
<div class="modal-body">
    <?php
//    echo "<input type=\"checkbox\" id=\"ckb_".$data["id"]."\" class=\"ckeckRow\" value=\"".$data["id"]."\">";
    $this->widget('bootstrap.widgets.TbGridView', array(
        'id' => 'medioEnvio-grid',
        'afterAjaxUpdate' =>
        "function(id,data){
            }",
        'type' => 'striped bordered hover advance',
        "template" => "{items}",
        'selectableRows' => 1,
        'dataProvider' => new CArrayDataProvider($medios_envio, array('pagination' => array('pageSize' => 5))),
        'columns' => array(
            array(
//                'name' => '<input type="checkbox"  id="selectall" value="all" container = Medioenvio >',
                'type' => 'raw',
//                'value' => '"<input type=\"checkbox\" id=\"ckb_".$data["id"]."\" class=\"ckeckRow\" value=\"".$data["id"]."\">"'
                'value' => '"<input type=\"checkbox\" id=\"ckb_".$data["id"]."\" class=\"ckeckRow\" value=\"".$data["id"]."\" container = Medioenvio>"',
            ),
            array(
                'header' => 'Medio Envio',
                'value' => 'CHtml::encode($data["nombre"])',
            ),
        ),
    ));
    ?>
</div>

<div class="modal-footer">
    <?php
    if ($campania_id == null) {
        $campania_id = "null";
    }
    $this->widget('bootstrap.widgets.TbButton', array(
        'type' => 'success',
        'icon' => 'ok',
        'label' => Yii::t('AweCrud.app', 'Continuar'),
        'htmlOptions' => array(
            'onClick' => 'js:ajaxAgregar(' . json_encode($contactos) . ',' . json_encode($alerta) . ',' . $campania_id . ')'
        )
    ));
    ?>
    <?php
    $this->widget('bootstrap.widgets.TbButton', array(
        'icon' => 'remove',
        'label' => Yii::t('AweCrud.app', 'Cancel'),
        'htmlOptions' => array('data-dismiss' => 'modal')
    ));
    ?>

</div>
<?php $this->endWidget(); ?>
